clear
clc
format short
date = datestr(datetime, 'yymmdd'); 
load joint_cha.mat
X=['JOINT',num2str(date),'_p.dat'];
diary (X);
disp('&ACCESS RVP');
disp('&REL 100');
disp('&PARAM EDITMASK = *');
disp('&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe');
disp('&PARAM DISKPATH = KRC:\R1\Program\liudong');
X=['DEFDAT JOINT',num2str(date),'_p'];
disp(X)%文件名
disp(';FOLD EXTERNAL DECLARATIONS;%{PE}%MKUKATPBASIS,%CEXT,%VCOMMON,%P');
disp(';FOLD BASISTECH EXT;%{PE}%MKUKATPBASIS,%CEXT,%VEXT,%P');
disp('EXT  BAS (BAS_COMMAND  :IN,REAL  :IN )');
disp('DECL INT SUCCESS');
disp(';ENDFOLD (BASISTECH EXT)');
disp(';FOLD USER EXT;%{E}%MKUKATPUSER,%CEXT,%VEXT,%P');
disp(';Make your modifications here');
fprintf('\n');
disp(';ENDFOLD (USER EXT)');
disp(';ENDFOLD (EXTERNAL DECLARATIONS)');
disp('DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "p1                     ",POINT2[] "p1                     ",CP_PARAMS[] "CPDAT0                  ",PTP_PARAMS[] "PDAT1                  ",CONT[] "C_DIS                   ",CP_VEL[] "2.0                     ",PTP_VEL[] "100                     ",SYNC_PARAMS[] "SYNCDAT                 ",SPL_NAME[] "S0                      ",A_PARAMS[] "ADAT0                   "}');
% fprintf(1,['DECL E6AXIS XP%d={A1 %.4f,A2 %.4f,A3 %.4f,A4 %.4f,A5 %.4f,A6 %.4f,E1 %.4f,E2 0.0,E3 0.0,E4 0.0,E5 0.0,E6 0.0}\n ' ...
%     'DECL FDAT FP%d={TOOL_NO 0,BASE_NO 0,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE} \n ' ...
%     'DECL PDAT PPDAT%d={VEL 100.000,ACC 100.000,APO_DIST 100.000,APO_MODE #CDIS,GEAR_JERK 50.0000,EXAX_IGN 0}\n'],x.');
% for i=1:2
i=1;
disp(['DECL E6AXIS XP' num2str(i) '={A1 ' num2str(joint_cha(i,1)) ',A2 ' num2str(joint_cha(i,2)) ',A3 ' num2str(joint_cha(i,3)) ',A4 ' num2str(joint_cha(i,4)) ',A5 ' num2str(joint_cha(i,5)) ',A6 ' num2str(joint_cha(i,6)) ',E1 ' num2str(joint_cha(i,7)) ',E2 ' num2str(joint_cha(i,8)) ',E3 0.0,E4 0.0,E5 0.0,E6 0.0}'])
disp(['DECL FDAT FP' num2str(i) '={TOOL_NO 2,BASE_NO 1,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}'])
disp(['DECL PDAT PPDAT' num2str(i) '={VEL 5.000,ACC 30.000,APO_DIST 30.000,APO_MODE #CDIS,GEAR_JERK 5.0000,EXAX_IGN 0}'])
i=2;
disp(['DECL E6AXIS XP' num2str(i) '={A1 ' num2str(joint_cha(i,1)) ',A2 ' num2str(joint_cha(i,2)) ',A3 ' num2str(joint_cha(i,3)) ',A4 ' num2str(joint_cha(i,4)) ',A5 ' num2str(joint_cha(i,5)) ',A6 ' num2str(joint_cha(i,6)) ',E1 ' num2str(joint_cha(i,7)) ',E2 ' num2str(joint_cha(i,8)) ',E3 0.0,E4 0.0,E5 0.0,E6 0.0}'])
disp(['DECL FDAT FP' num2str(i) '={TOOL_NO 2,BASE_NO 1,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}'])
disp(['DECL PDAT PPDAT' num2str(i) '={VEL 100.000,ACC 100.000,APO_DIST 30.000,APO_MODE #CDIS,GEAR_JERK 5.0000,EXAX_IGN 0}'])
% end
disp('ENDDAT');
diary off;